Skip to content

Conversation

@kevint-cerebras
Copy link

why

The Cerebras integration was out of date when it came to models and also nonfunctional during testing.

what changed

Updated the Cerebras provider file to work with OpenAI format + added most recently released Cerebras models.

test plan

I used the form_filling_sensible file and the 2048 tests to run through all the Cerebras models in the PR

tkattkat and others added 22 commits September 10, 2025 13:40
# why

solves browserbase#1060 
patch regression of playwright arguments being removed from agent
execute response

# what changed

agent.execute now returns playwright arguments in its response 

# test plan

tested locally
…ms to docs (browserbase#1065)

# why

reflect project id changes in docs

# what changed

advanced configuration comments

# test plan

reviewed via mintlify on localhost
# why

Easier to use for Custom LLM Clients and keep users up to date with our
aisdk file

# what changed

added export of aisdk to lib/index.ts

# test plan

build local stagehand, import local AISdkClient, run Azure Stagehand
session
…onfigu… (browserbase#1073)

…ration settings

# why

Updated docs to match the new fingerprint params in the Browserbase docs
here:
https://docs.browserbase.com/guides/stealth-customization#customization-options

# what changed

Update browser configuration docs to reflect the docs changes. 

# test plan
# why

Updating docs to reflect aisdk can be imported directly

# what changed

The model page

# test plan

Reviewed page with mintlify dev locally
# why

# what changed

# test plan
# why

Currently, we do not support stagehand agent within the api

# what changed

When api is enabled, stagehand agent now routes through the api 

# test plan

Tested locally
# why

Currently, using playwright screenshot command is not available when the
execution environment is Stagehand. A customer has indicated they would
prefer to use Playwright's native screenshot command instead of CDP when
using Browserbase as CDP screenshot causes unexpected behavior for their
target site.

# what changed

- added a StagehandScreenshotOptions type with useCDP argument added
- extended page type to accept custom stagehand screeenshot options
- update screenshot proxy to default useCDP to true if the env is
browserbase and use playwright screenshot if false
- added eval for screenshot with and without cdp

# test plan
- tested and confirmed functionality with eval and external example
script (not committed)
…rowserbase#1057)

# why

We want to build a best in class agent in stagehand.
Therefore, we need more eval benchmarks.

# what changed
- Added Web-bench evals dataset
- Added a subset of OS World evals - those that can be run in a chrome
browser (desktop-based tasks omitted)
- added LICENSE noticed to the copied evals tasks
- Added ground truth / expected result to some WebVoyager tasks using
reference_answer.json from Browser Use public evals repo.

Improvements to `pnpm run evals -man` to better describe how to run
evals.

# test plan
Evals should run locally and bb for these new benchmarks.
# why
Initial instructions didn't mention uv or pip prerequisites and also
didn't mention venv. Fix reduces friction on first timers.

# what changed
- added link to install uv
- added details for initializing venv
- adjusted code example respectively 

# test plan
docs change
# why
- webpage structure changed, needed to update the xpath in the expected
locator
… with LanguageModelV1 + LiteLLM works for python (browserbase#1086)

# why

1. aisdk not yet available through npm package
2. customLLM provider only works with LanguageModelV1
3. LiteLLM compatible providers are supported in python

# what changed

1. change docs to install stagehand from git repo
2. pin versions that use LanguageModelV1

# test plan

local test
# why

currently we pass stagehand page to agent, this results in our page
management having issues when facing new tabs

# what changed

the stagehand object is now passed instead of stagehandPage

# test plan

tested locally
# why

Our existing screenshot service is a dummy time-based triggered service.
It also does not trigger based on any actions of the agent.

# what changed
Added img hash diff algo (quick check with MSE, verify with SSIM algo)
to see if there was an actual UI change and only store ss in the buffer
if that is so.

Added ss interceptor which copies each screenshot the agent is taking to
a buffer (if different enough from the previous ss) to be later used for
evals.

- There's also a small refactor of the agent initialization config to
enable the screenshot collector service to be attached

# test plan
Tests pass locally

---------

Co-authored-by: Miguel <[email protected]>
Co-authored-by: miguel <[email protected]>
# why
To help make sense of eval test cases and results

# what changed
Added metadata to eval runs, cleaned deprecated code

# test plan
# why

# what changed

# test plan
# why

anthropic released a new sota computer use model

# what changed

added claude-sonnet-4-5-20250929 as a model to the list

# test plan

ran evals
@changeset-bot
Copy link

changeset-bot bot commented Oct 1, 2025

⚠️ No Changeset found

Latest commit: 3e50149

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR modernizes and fixes the Cerebras LLM provider integration by refactoring the implementation to use OpenAI-compatible format. The key changes include completely rewriting the `CerebrasClient` to use composition with the existing `OpenAIClient` rather than maintaining a custom implementation, adding 7 new Cerebras model mappings, exposing the client via exports, and completing the documentation.

The architecture change eliminates ~300 lines of duplicate code by leveraging the existing OpenAI client infrastructure while transforming Cerebras API configuration (baseURL, API keys) and model names to be compatible. The implementation strips the 'cerebras-' prefix from model names when communicating with the actual Cerebras API and properly handles logging categorization. This approach reduces maintenance burden and improves reliability by reusing battle-tested code paths from the OpenAI implementation.

Important Files Changed

Changed Files
Filename Score Overview
lib/llm/CerebrasClient.ts 4/5 Complete refactoring from custom implementation to OpenAI client wrapper, dramatically simplifying the codebase
lib/llm/LLMProvider.ts 2/5 Added 7 new Cerebras model mappings but model names not defined in type schema, risking validation failures
lib/index.ts 5/5 Added missing export for CerebrasClient to make it publicly available
docs/configuration/models.mdx 5/5 Added missing CEREBRAS_API_KEY documentation to complete provider setup instructions

Confidence score: 3/5

  • This PR improves code maintainability by eliminating duplicate implementation but has a type safety issue that could cause runtime failures
  • Score reflects the architectural improvement balanced against the missing type definitions for new model names in the schema validation
  • Pay close attention to lib/llm/LLMProvider.ts where new model names need to be added to the AvailableModelSchema type definition

Sequence Diagram

sequenceDiagram
    participant User
    participant Stagehand
    participant LLMProvider
    participant CerebrasClient
    participant OpenAIClient
    participant CerebrasAPI as "Cerebras API"

    User->>Stagehand: "new Stagehand({modelName: 'cerebras-llama-3.3-70b'})"
    Stagehand->>LLMProvider: "getClient(modelName, clientOptions)"
    LLMProvider->>LLMProvider: "Check modelToProviderMap['cerebras-llama-3.3-70b']"
    LLMProvider->>CerebrasClient: "new CerebrasClient(options)"
    CerebrasClient->>CerebrasClient: "Transform model name: remove 'cerebras-' prefix"
    CerebrasClient->>OpenAIClient: "new OpenAIClient({baseURL: 'https://api.cerebras.ai/v1'})"
    OpenAIClient-->>CerebrasClient: "OpenAI client instance"
    CerebrasClient-->>LLMProvider: "CerebrasClient instance"
    LLMProvider-->>Stagehand: "LLM client"
    Stagehand-->>User: "Stagehand instance"

    User->>Stagehand: "page.act('click button')"
    Stagehand->>CerebrasClient: "createChatCompletion(options)"
    CerebrasClient->>OpenAIClient: "createChatCompletion(options)"
    OpenAIClient->>CerebrasAPI: "POST /v1/chat/completions"
    CerebrasAPI-->>OpenAIClient: "Chat completion response"
    OpenAIClient-->>CerebrasClient: "LLM response"
    CerebrasClient-->>Stagehand: "LLM response"
    Stagehand-->>User: "Action result"
Loading

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@kevint-cerebras
Copy link
Author

@greptileai

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This review covers only the changes made since the last review, not the entire PR. The developer has addressed the previous review feedback by adding the missing Cerebras model identifiers to the `AvailableModelSchema` enum in `types/model.ts`.

The change adds seven new Cerebras model identifiers: cerebras-gpt-oss-120b, cerebras-llama-4-maverick-17b-128e-instruct, cerebras-llama-4-scout-17b-16e-instruct, cerebras-qwen-3-235b-a22b-instruct-2507, cerebras-qwen-3-235b-a22b-thinking-2507, cerebras-qwen-3-32b, and cerebras-qwen-3-coder-480b. This change ensures type validation will work correctly when users specify these newer Cerebras models in their configurations.

The models are appropriately placed in the enum structure, maintaining alphabetical ordering within the Cerebras section and preserving the overall organization of the schema. This addresses the core issue identified in the previous review where the LLM provider code supported these models but the type system would reject them during validation.

Important Files Changed

Changed Files
Filename Score Overview
types/model.ts 5/5 Added seven new Cerebras model identifiers to AvailableModelSchema enum to enable type validation

Confidence score: 5/5

  • This change is safe to merge with minimal risk as it only adds new enum values without modifying existing functionality
  • Score reflects the straightforward nature of adding enum values and the fact that this directly addresses the previous review feedback
  • No files require special attention as this is a simple type schema update

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants